<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="text" id="ipt">
    <script>
        let obj = {};

        let val = '';

        let ipt = document.querySelector('#ipt');

        // obj.name = 'zs';

        //name访问器属性
        Object.defineProperty(obj,'price',{
            get(){
                console.log("获取值")
                return `$`+val
            },
            set(newVal){
                console.log("设置值")
                val = newVal;
                ipt.value = newVal;
            }
        })

        ipt.addEventListener('input',(e) => {
            val = e.target.value
        })
    </script>  
    <!-- 周考历史题 ---弄明白  -->
    <!-- 单例 发布订阅模式   数据劫持 -->
</body>
</html>